# CellularFloor

A system of cells that can pass signals to each other and morph into different
types in order to generate a floor plan.
Right now there are 2 types: a Room and a Corridor.
Corridor (MAGENTA) receives bonuses for fetching as many valid rooms as possible without 
becoming too big.
Room (GREEN) receives bonuses for being connected to a valid corridor or to another valid room. 

## Mechanics

Signals are represented as 2D fields which can be both positive and negative. 
At each tick a cell receives fields of neighbors and transforms them using a 
SIGNAL_COUNTxSIGNAL_COUNT matrix of its type.

It then proceeds to add its own production vector to it.

If fields are matching a proliferation condition, cell changes its type.

By the end of all ticks, rooms are segregated according to room type and also by
values of first 2 signals. These 2 signals's signs create a 2 bit field with 4
possible values, which is enough in graph coloring theory to make an arbitrary
2D segregation even without type differences.

After segregation, chambers are scored.

System maintains a limited population of "individuums" that mutate their cell
types (signal transformation matrices, production vectors and proliferation
conditions). Each individuum is given several tries (i tried with around 10 and
100) and its score is averaged.
For each try, initial state is a floor filled with a random mix of cells of both
types.

Every 30 generations there is a reevaluation when every individuum is retested
with 3 times as much trials as usual. This weeds out some of individuums that
were just too lucky and now stuck at the leaderboard.

Unfortunately, the mechanism is too random for even 100-average score value to be
stable so search is kinda hard.

## GUI

![image](https://notabug.org/Houkime/CellularFloor/raw/6f3c4fdf8448f556f6e20bbbdf7f9333b30fdef3/pictures/GUI.jpg)

* At the left, you see a live view of current individuum
* At the bottom-middle, you see a segregated vision of every n-th individuum going
by. (you canot see walls live because they are very short-lived)
* At the center-right you see a table of scores of current population where -1
means "untested".
* At the right you see a selector where you can choose which signal you want to
see live and a button to start or stop a background thread that does actual
computations.

## Notes 

For large signal counts it might be hard to find a non-0 score.
Most common way individuums obtain 0 score is by not proliferating a single
cell over their entire trial course.
